//
//  YSPMSInfoListCell.m
//  mhome
//
//  Created by YaSha_Tom on 2018/12/6.
//  Copyright © 2018年 刘春雷. All rights reserved.
//

#import "YSPMSInfoListCell.h"

@interface YSPMSInfoListCell ()

@property (nonatomic, strong) ProjectListModel *cellModel;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *addressLabel;
@property (nonatomic, strong) UILabel *typeLabel;

@end

@implementation YSPMSInfoListCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

- (void)initUI {
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:16];
    self.titleLabel.textColor = [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0];
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top).offset(15);
        make.left.mas_equalTo(self.contentView.mas_left).offset(15);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-15);
        make.height.mas_equalTo(16*kHeightScale);
    }];
    
    self.addressLabel = [[UILabel alloc]init];
    self.addressLabel.font = [UIFont systemFontOfSize:12];
    self.addressLabel.textColor =[UIColor colorWithRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1.0];
    [self.contentView addSubview:self.addressLabel];
    [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(15);
        make.left.mas_equalTo(self.titleLabel.mas_left);
        make.right.mas_equalTo(self.titleLabel.mas_right);
        make.height.mas_equalTo(14*kHeightScale);
    }];
    
    self.typeLabel = [[UILabel alloc]init];
    self.typeLabel.font = [UIFont systemFontOfSize:12];
    self.typeLabel.textColor = [UIColor redColor];
    [self.contentView addSubview:self.typeLabel];
    [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.addressLabel.mas_bottom).offset(10);
        make.left.mas_equalTo(self.titleLabel.mas_left);
        make.right.mas_equalTo(self.titleLabel.mas_right);
        make.height.mas_equalTo(14*kHeightScale);
    }];
}

- (void)setCellModel:(ProjectListModel *)cellModel {
    _cellModel = cellModel;
    self.titleLabel.text = _cellModel.name;
    self.addressLabel.text = [NSString stringWithFormat:@"%@%@%@",_cellModel.province, _cellModel.city, _cellModel.area];
    NSString *formatStr;
    formatStr = [NSString stringWithFormat:@"%@-%@",_cellModel.statusStr, _cellModel.proStatusName];
    self.typeLabel.text = formatStr;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
